package it.hopeless.jee6.hello;

import javax.annotation.PostConstruct;
import javax.ejb.Stateful;
import javax.enterprise.context.SessionScoped;
import javax.inject.Named;

@Stateful
@Named("counter")
@SessionScoped
public class SimpleCounter {
    private int counter = 0;

    @PostConstruct
    public void reset(){
        System.out.println("RESET " + counter);
        counter = 0;
    }

    public int getCounter(){
        System.out.println("COUNTER " + counter);
        return counter++;
    }
}
